package ua.kharkov.knure.pereverziev.diploma.db.DAOServices;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ua.kharkov.knure.pereverziev.diploma.db.entity.UserRole;

public class UserRoleService extends CommonService<UserRole> {

	private final Logger log = LoggerFactory.getLogger(UserRoleService.class);

	public UserRoleService() {
		super(UserRole.class);
	}

	public UserRole getRoleByName(final String role) {
		final List<UserRole> roles = getList(new UserRole(role));
		UserRole userRole = null;
		if (roles != null && roles.size() == 1)
			userRole = roles.get(0);
		else
			log.warn("No or more than one record found for status=" + role);
		return userRole;
	}
}
